package com.monitor.controller;

import com.alibaba.fastjson2.JSONObject;
import com.monitor.commons.HttpTookit;
import com.monitor.commons.StringUtil;
import com.monitor.config.yunke.DeptAndUser;
import com.monitor.config.yunke.DeptUserResult;
import com.monitor.config.yunke.YunKeConfig;
import com.monitor.config.yunke.YunKeUtil;
import com.monitor.dto.DeptDTO;
import com.monitor.dto.DeptPageDTO;
import com.monitor.model.Dept;
import com.monitor.model.User;
import com.monitor.modelExt.DeptExt;
import com.monitor.modelExt.UserExt;
import com.monitor.pubInter.IBaseService;
import com.monitor.pubInter.exception.SkException;
import com.monitor.searchExt.DeptSearchExt;
import com.monitor.searchExt.UserSearchExt;
import com.monitor.service.IDeptService;
import com.monitor.service.IUserService;
import com.monitor.vo.DeptDetailDomainVO;
import com.monitor.vo.DeptDetailVO;
import com.monitor.vo.DeptDomainVO;
import com.monitor.vo.DeptListVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;
import java.util.stream.Collectors;


@RequestMapping("/dept/")
@RestController(value = "deptController")
@Slf4j
public class DeptControlller extends ApiManageController<DeptDTO, DeptPageDTO, DeptExt, DeptSearchExt, DeptDomainVO, DeptDetailDomainVO, DeptDetailVO, DeptListVO, String> {
    @Autowired
    private IDeptService deptService;
    @Autowired
    private IUserService userService;

    @Override
    public IBaseService<DeptExt, DeptSearchExt, String> getBaseService() throws SkException {
        return deptService;
    }




    /**
     * 获取部门和员工信息
     *
     * @return
     * @throws Exception
     */
    @RequestMapping("queryDeptsAndUsers")
    public String queryDeptsAndUsers() throws Exception {
        deptService.fetchAndUpdateDeptAndUser();
        return "res";
    }


}
